﻿namespace Methods
{
    using System;

    public class Point
    {
        public Point(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }

        public double X { get; private set; }

        public double Y { get; private set; }

        public double CalcDistance(Point otherPoint)
        {
            double firstPointX = this.X;
            double firstPointY = this.Y;
            double secondPointX = otherPoint.X;
            double secondPointY = otherPoint.Y;
            double distance = Math.Sqrt(((secondPointX - firstPointX) * (secondPointX - firstPointX)) +
                                        ((secondPointY - firstPointY) * (secondPointY - firstPointY)));

            return distance;
        }

        public bool InHorizontalLineWith(Point otherPoint)
        {
            return this.Y == otherPoint.Y;
        }

        public bool InVerticalLineWith(Point otherPoint)
        {
            return this.X == otherPoint.X;
        }
    }
}